<%@ page import="java.sql.Connection" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/core/dao.jsp" %>
<%!

    /**
     * 初始化
     * @return
     */
    private boolean _transition_init() {
        boolean result = false;

        try {
            _db_conn.set(_db_getConnection());
            result = true;
        } catch (Exception e) {
            try {
                _db_destory(_db_conn.get(), null, null);
            } catch (SQLException e1) {
                e1.printStackTrace();
            }
            e.printStackTrace();
        }

        return result;
    }

    /**
     * 开始事务
     * @param auto
     * @throws SQLException
     */
    private void _transition_begin(boolean auto) throws SQLException {
        this._db_conn.get().setAutoCommit(auto);
    }

    /**
     * 结束事务
     * @throws SQLException
     */
    private void _transition_commit() throws SQLException {
        this._db_conn.get().commit();
        this._db_destory(this._db_conn.get(), null, null);
    }

    /**
     *
     * @throws SQLException
     */
    private void _transition_rollback() throws SQLException {
        this._db_conn.get().rollback();
        this._db_destory(this._db_conn.get(), null, null);
    }
%>